package com.hongyue.dey02;

public class MaoPao {
    public static void main(String[] args) {
        int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        int s = 3;
        int d = 0;
        int t = 0;
        int w = a.length - 1;
        while (t < w) {
            int z = (t + w) / 2;
            if (s < a[z]) {
                w = z - 1;
            } else if (s > a[z]) {
                t = z + 1;
            } else {
                d = z;
                break;
            }
        }
        System.out.println(d);
    }
}
